import { Prop, getModelForClass } from "@typegoose/typegoose";

enum CATEGORY {
    FOOD = '0',
    SOUP = '1',
    SWEET = '2',
    DRINK = '3'
}
export class Food {

    @Prop({ required: true, maxlength: 10, type: String })
    title
    @Prop({ required: true, type: String })
    user_id
    @Prop({ type: String, default: '/deliciousimg/default/780.jpg' })
    Cover_img
    @Prop({ required: true, type: String })
    rich_text
    @Prop({ required: true, type: String })
    rich_text2
    @Prop({ required: true, type: String })
    texttual
    @Prop({ required: true, type: Array, default: [] })
    catalog
    @Prop({ required: true, type: Number, default: Date.now() })
    publish_time
    @Prop({ required: true, type: Number, default: 0 })
    review
    @Prop({ required: true, enum: CATEGORY, type: String, default: '0' })
    type: CATEGORY
}


export const FoodModel = getModelForClass(Food, {
    schemaOptions: { collection: 'food' },
})